package models.order;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import models.user.Customer;
import play.db.jpa.Model;

/**
 * 发件人信息表与订单表的关系是 1对多
 * 
 * @author yechao
 * @date 2013年11月3日
 */
@Entity
@Table(name = "order_sender")
public class OrderSender extends Model {
	/**
	 * 客户Id customer表的id
	 */
	@Column(name = "customer_id")
	public Long customer_id;
	/**
	 * 客户帐号
	 */
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH }, optional = false, fetch = FetchType.LAZY)
	@JoinColumn(name = "customer_id", insertable = false, updatable = false)
	public Customer customer;
	/**
	 * 发件人国家
	 */
	@Column(name = "country")
	public String country;
	/**
	 * 省
	 */
	@Column(name = "province")
	public String province;
	/**
	 * 城市
	 */
	@Column(name = "city")
	public String city;
	/**
	 * 县
	 */
	@Column(name = "county")
	public String county;
	/**
	 * 邮政编码
	 */
	@Column(name = "post_code")
	public String postCode;
	/**
	 * 街道1
	 */
	@Column(name = "street1")
	public String street1;

	/**
	 * 街道2
	 */
	@Column(name = "street2")
	public String street2;

	/**
	 * 公司
	 */
	@Column(name = "company")
	public String company;
	/**
	 * 发件人
	 */
	@Column(name = "name")
	public String name;

	/**
	 * 是否默认 客户可以配置多个发件人地址. 可以设置默认地址也可以为每个订单设置不一样的地址
	 */
	@Column(name = "is_default")
	public Integer isDefault;
}
